var t = new(require("../../../utils/http.js").HTTP);
Page({
    data: {
        list: !1,
        shoopingarray: [],
        arr: "",
        min: 0,
        max: "",
        roomNum: "",
        purpose: [],
        show: !0
    },
    selectEvent: function (t) {
        this.setData({
            section: t.detail.selectedID,
            nowText: t.detail.nowText
        }),
        this.search()
    },
    search: function () {
        var a = this;
        a.data.roomNum ? 1 == a.data.id ? null != a.data.nowText ? "公司" == a.data.nowText ? t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 2,
                fjh: a.data.roomNum
            }
        }).then((function (t) {
                0 == t.data.length ? wx.showToast({
                    title: "暂无该房源信息",
                    icon: "none"
                }) : a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 6,
                fjh: a.data.roomNum,
                xiangmu: a.data.nowText
            }
        }).then((function (t) {
                0 == t.data.length ? wx.showToast({
                    title: "暂无该房源信息",
                    icon: "none"
                }) : a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 2,
                fjh: a.data.roomNum
            }
        }).then((function (t) {
                0 == t.data.length ? wx.showToast({
                    title: "暂无该房源信息",
                    icon: "none"
                }) : a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : "公司" == a.data.nowText || null == a.data.nowText ? t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 4,
                fjh: a.data.roomNum
            }
        }).then((function (t) {
                0 == t.data.length ? wx.showToast({
                    title: "暂无该房源信息",
                    icon: "none"
                }) : a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 8,
                fjh: a.data.roomNum,
                xiangmu: a.data.nowText
            }
        }).then((function (t) {
                0 == t.data.length ? wx.showToast({
                    title: "暂无该房源信息",
                    icon: "none"
                }) : a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : wx.showToast({
            title: "请输入房间号",
            icon: "none"
        })
    },
    onLoad: function (a) {
        var o = this,
        n = wx.getStorageSync("user");
        2 == a.id && (wx.setNavigationBarTitle({
                title: "已出租"
            }), n[4] < 7 && this.setData({
                show: !1
            })),
        this.setData({
            id: a.id,
            user: n
        }),
        t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 5
            }
        }).then((function (t) {
                var a = t.data;
                t.data.unshift({
                    text: "公司",
                    id: 20
                }),
                o.setData({
                    purpose: a
                })
            }))
    },
    doSubmits: function () {
        var a = this;
        parseInt(a.data.max) > parseInt(a.data.min) ? 1 == a.data.id ? t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 1,
                num: a.data.max
            }
        }).then((function (t) {
                a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : a.data.user[4] > 6 ? t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 3,
                num: a.data.max
            }
        }).then((function (t) {
                a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : t.request({
            url: "https://www.qlsyyun.com:3030/roomSearch",
            data: {
                arr: 7,
                num: a.data.max,
                zhuti: a.data.user[1]
            }
        }).then((function (t) {
                a.setData({
                    list: !0,
                    shoopingarray: t.data
                })
            })) : wx.showToast({
            title: "输入值不合法",
            icon: "none"
        })
    },
    shoppinginput: function (t) {
        this.setData({
            roomNum: t.detail.value
        })
    },
    oninput: function (t) {
        this.setData({
            min: t.detail.value
        })
    },
    oninputs: function (t) {
        this.setData({
            max: t.detail.value
        })
    }
});
